<template>
  <view class="container">
    <view class="top">
      <image @click="goIncomeExplain" class="question" src="/static/common/question-icon.png" mode=""></image>
      <view class="total">
        <view class="money-name">累计收入</view>
        <view class="money">
          <text>￥</text>
          <text>1000.00</text>
        </view>
      </view>
      <view class="money-box flex">
        <view class="item">
          <view class="money-name">本月确认收货</view>
          <view class="money">
            <text>￥</text>
            <text>1000.00</text>
          </view>
        </view>
        <view class="item">
          <view class="money-name">上月确认收货</view>
          <view class="money">
            <text>￥</text>
            <text>1000.00</text>
          </view>
        </view>
        <view class="item">
          <view class="money-name">待确认收货</view>
          <view class="money">
            <text>￥</text>
            <text>1000.00</text>
          </view>
        </view>
      </view>
      <view class="tips flex">订单确认收货次月25号可提现</view>
    </view>
    <view class="tabs flex">
      <view @click="tabClick('day')" :class="{ active: currentTab == 'day' }">今日统计</view>
      <view @click="tabClick('month')" :class="{ active: currentTab == 'month' }">本月统计</view>
    </view>
    <view class="statistics">
      <view class="title flex">
        收益统计
        <view @click="goHistory" class="flex history">历史概况</view>
      </view>
      <view class="num-box">
        <view class="item">
          <view class="money-name">订单数</view>
          <view class="money">1000</view>
        </view>
        <view class="item">
          <view class="money-name">预估收益(元)</view>
          <view class="money">
            <text>￥</text>
            <text>1000.00</text>
          </view>
        </view>
      </view>
    </view>
    <view class="list">
      <view class="title">
        <view>来源</view>
        <view>订单笔数</view>
        <view>预估收益</view>
      </view>
      <view>
        <view>淘宝</view>
        <view>12</view>
        <view>¥34.98</view>
      </view>
      <view>
        <view>淘宝</view>
        <view>12</view>
        <view>¥34.98</view>
      </view>
      <view>
        <view>淘宝</view>
        <view>12</view>
        <view>¥34.98</view>
      </view>
      <view>
        <view>淘宝</view>
        <view>12</view>
        <view>¥34.98</view>
      </view>
      <view>
        <view>淘宝</view>
        <view>12</view>
        <view>¥34.98</view>
      </view>
      <view>
        <view>淘宝</view>
        <view>12</view>
        <view>¥34.98</view>
      </view>
      <view>
        <view>淘宝</view>
        <view>12</view>
        <view>¥34.98</view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue';
const currentTab = ref('day');
const tabClick = (val) => {
  if (currentTab.value == val) return;
  currentTab.value = val;
};
const goHistory = () => {
  uni.navigateTo({
    url: '/subPages/incomeHistory/incomeHistory',
  });
};
const goIncomeExplain = () => {
  uni.navigateTo({
    url: '/subPages/incomeExplain/incomeExplain',
  });
};
</script>

<style lang="scss" scoped>
.container {
  background: #f8f8f8;
  min-height: 100vh;
  padding: 12px 12px 20px;
  .money-name {
    font-weight: 400;
    font-size: 12px;
    color: #999999;
    margin-bottom: 10px;
  }
  .money {
    color: #333;
    font-weight: 600;
    text {
      font-size: 12px;
      &:last-child {
        font-size: 18px;
      }
    }
  }
  .top {
    background: radial-gradient(35% 80% at 100% 0%, #ffdcdd 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 0 12px;
    position: relative;
    .question {
      width: 16px;
      height: 16px;
      position: absolute;
      right: 12px;
      top: 10px;
    }
    .total {
      padding-top: 12px;
      .money-name {
        margin-bottom: 10px;
      }
      .money {
        text {
          font-size: 14px;
          &:last-child {
            font-size: 20px;
          }
        }
      }
    }
    .money-box {
      justify-content: space-between;
      margin-top: 18px;
      .item {
        width: 33.3%;
        position: relative;
        padding-left: 12px;
        &::before {
          content: '';
          display: block;
          width: 1px;
          height: 12px;
          background: #f0f0f0;
          position: absolute;
          left: 0;
          top: 50%;
          transform: translateY(-50%);
        }
        &:first-child {
          padding-left: 0;
          &::before {
            display: none;
          }
        }
      }
    }
    .tips {
      height: 40px;
      color: #999999;
      font-weight: 400;
      font-size: 12px;
      margin-top: 12px;
      border-top: 1px solid #9999994d;
    }
  }
  .tabs {
    margin-top: 12px;
    height: 40px;
    background: #ffeeee;
    border-radius: 8px;
    justify-content: space-between;
    padding: 2px;
    view {
      flex: 1;
      height: 36px;
      border-radius: 6px;
      line-height: 36px;
      text-align: center;
      font-weight: 400;
      font-size: 16px;
      color: #333;
      &.active {
        background: #ffffff;
        color: #ff0309;
      }
    }
  }
  .statistics {
    background-color: #ffffff;
    margin-top: 12px;
    padding: 0 12px 12px;
    border-radius: 12px;
    .title {
      height: 44px;
      justify-content: space-between;
      color: #000;
      font-weight: 500;
      font-size: 16px;
      .history {
        color: #333;
        font-weight: 400;
        font-size: 12px;
        &::after {
          content: '';
          display: inline-block;
          width: 5px;
          height: 5px;
          border-top: 1px solid #333;
          border-right: 1px solid #333;
          transform: rotate(45deg);
          margin-left: 4px;
        }
      }
    }
    .num-box {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
      .item {
        border-radius: 8px;
        background: #ffeeee;
        padding: 12px;
        .money-name {
          margin-bottom: 6px;
        }
      }
    }
  }
  .list {
    margin-top: 12px;
    background: #fff;
    border-radius: 12px;
    > view {
      height: 44px;
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      text-align: center;
      line-height: 44px;
      color: #333;
      font-weight: 400;
      font-size: 12px;
      &.title {
        height: 48px;
        line-height: 48px;
        border-bottom: 1px solid #e1e1e1;
        color: #666;
      }
      &:nth-child(odd):not(.title) {
        background: #fcfcfc;
      }
    }
  }
}
</style>
